var setTime = 180;
var idleTime = 0;
var standby = false;
function CheckInactivity() {
        idleTime += 10;
        if (idleTime > setTime) {
                InitializeStandBy();
        }
}
function InitializeStandBy() {
        if (!standby) {
                var h = 0;
                h = $(window).height();
                $("#energysaving").show().css({
                        height: "0",
                        width: "0",
                        left: "50%",
                        top: "50%"
                }).animate({
                        width: "100%",
                        height: h,
                        left: "0",
                        top: "0",
                        opacity: "1"
                },
                1000);
                standby = true;
        }
}
function StopStandBy() {
        if (standby) {
                $("#energysaving").animate({
                        width: "0",
                        height: "0",
                        opacity: "0",
                        left: "50%",
                        top: "50%"
                },
                500);
                setTimeout('$("#energysaving").hide();', 800);
                standby = false;
        }
}
function InitJQuery() {
        if (typeof(jQuery) == "undefined") {
                setTimeout("InitJQuery();", 50);
        } else {
                $(function() {
                        $(document).ready(function() {
                                setInterval("CheckInactivity();", 10000);
                                $(this).mousemove(function(e) {
                                        idleTime = 0;
                                        StopStandBy();
                                });
                                $(document).keypress(function(e) {
                                        idleTime = 0;
                                        StopStandBy();
                                });
                                $("body").append('<div id="energysaving"><p>Energy saving mode by idlohulhaqDOTcom and Knight of Access<br /><span>Move your mouse to go back to the page.</span></p><div id="idlohulhaq">Copyright 2009 <font style="color: #666666;">idlohulhaqDOTcom</font> - free to use</div></div>');
                                $("#energysaving").hide();
                        });
                });
        }
}
InitJQuery();